UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WBTsTPpQGd/SYlhRIiIKvEi6iwFDRtMk7Ji2ilAWvDs=' 
WHERE 
  key_id = '043fa2ecc0cecbbd1cc735297c949d96371fb1ccec96397d07980dbc726f2087' 
  AND (
    token = 'WBTsTPpQGd/SYlhRIiIKvEi6iwFDRtMk7Ji2ilAWvDs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045