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

Query time 0.00021