UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pmCsgvujg6FRBUYHH5YEOGKscSIaR+8JYgEMqwMRBvU=' 
WHERE 
  key_id = '4f5edafbf83e8ca6f889951d876d76ccda982950083472126a9716077f57efe2' 
  AND (
    token = 'pmCsgvujg6FRBUYHH5YEOGKscSIaR+8JYgEMqwMRBvU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045