UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wFz+dAyyE2J5Xz381DJ996BRahK/hC58XszjDNIyLeo=' 
WHERE 
  key_id = 'c21ce290867abcef2558bc55b692def25f5ca95a513aa9c668377774263216d6' 
  AND (
    token = 'wFz+dAyyE2J5Xz381DJ996BRahK/hC58XszjDNIyLeo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042