UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ePMa95i2bgbMJTwNctJqw46lwEROLX1K9lj0n0/uryo=' 
WHERE 
  key_id = '9a7fdde9ccfcfba8b752165c4f433d3453b0c92de1b40dd7601624c108d6f430' 
  AND (
    token = 'ePMa95i2bgbMJTwNctJqw46lwEROLX1K9lj0n0/uryo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050