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

Query time 0.00016