UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ogFTQddcurM9gEO5kZ4XWVVWr+Wn2+RgE1RXH8v6k2Q=' 
WHERE 
  key_id = '8c677e9a1a3d003012e70f1dc7ae74fc7056d5210e2b69d64aaa52ef02347b85' 
  AND (
    token = 'ogFTQddcurM9gEO5kZ4XWVVWr+Wn2+RgE1RXH8v6k2Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029