UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WyYQCrB3hqQ5GIuvk0mV9BBTu63c6aJLNG8JzJ7pbTg=' 
WHERE 
  key_id = '2820635745cbfff0b2de24cae8309dd647499dd333b5eeb3f7003264498179e9' 
  AND (
    token = 'WyYQCrB3hqQ5GIuvk0mV9BBTu63c6aJLNG8JzJ7pbTg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022