UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gSp+08aN+Y5k+vUp6+E6uxL/MU/9qtr7ijyN1+PCuUk=' 
WHERE 
  key_id = '34350325b3b098cea6e91eb40a02da1872c017f85c06681cd994f9af82cdcb6d' 
  AND (
    token = 'gSp+08aN+Y5k+vUp6+E6uxL/MU/9qtr7ijyN1+PCuUk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022