UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eLk032ZzU3RpxskByYyilbqHOtqm6OCvCENf5hYfJaA=' 
WHERE 
  key_id = 'c8ab6f8d4e0de9f0b0f9919ffa23b34f807c6bdf38afd2d20c1bb9d5d0fbc0bb' 
  AND (
    token = 'eLk032ZzU3RpxskByYyilbqHOtqm6OCvCENf5hYfJaA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026