UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7cskspWLCWgGLvX+mK3Bx4yDBPrSQyM1uFooPMnxwnw=' 
WHERE 
  key_id = 'd2524429849e2a250a9376d50bdc9be5e3eada8440b604b53f2c22a1bd3cf80a' 
  AND (
    token = '7cskspWLCWgGLvX+mK3Bx4yDBPrSQyM1uFooPMnxwnw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032