UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NrFkh3ns4fVrN0rnAWphLTXcZ8INXdaUa2BbwvqY3Rs=' 
WHERE 
  key_id = '488e8f4830b017734c5a450e0b1eba929795ba561e079b0e8b8166aa3d5b8268' 
  AND (
    token = 'NrFkh3ns4fVrN0rnAWphLTXcZ8INXdaUa2BbwvqY3Rs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034