UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fqP1SiwfHd6GU7yOxjLOQsLw0B47MBrM2jfAzOkQGXY=' 
WHERE 
  key_id = 'cfb9768d6e92c72d970a412ab52fa979da9ced0243437e195b0e59d855276304' 
  AND (
    token = 'fqP1SiwfHd6GU7yOxjLOQsLw0B47MBrM2jfAzOkQGXY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030