UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tHj4IZ7hA2hv87TOCbTU42SaCAgjEQu2W1CKarzlCQs=' 
WHERE 
  key_id = '1eba9e6350d20b0b62313458c21d8ce6028b03495d406f5759c027e848f954bb' 
  AND (
    token = 'tHj4IZ7hA2hv87TOCbTU42SaCAgjEQu2W1CKarzlCQs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040