UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g6BvQbJ0xZRQ2bIHxBfeyNmJBmxiaKZZle+eJhilwL8=' 
WHERE 
  key_id = 'f994334efc2b068d4eeeb3e46c2ee1931a73e9b0d0abe31ab663a80856e39c7d' 
  AND (
    token = 'g6BvQbJ0xZRQ2bIHxBfeyNmJBmxiaKZZle+eJhilwL8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034