UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ahlDUFw8AtWyF+2CRuvhOdUNfAHC458LgXcj0Y58vmc=' 
WHERE 
  key_id = '9a9a29c9b10ad965ad7a935cee4d45fbc4a3ba327f8379e8f654c44c4420d665' 
  AND (
    token = 'ahlDUFw8AtWyF+2CRuvhOdUNfAHC458LgXcj0Y58vmc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019