UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ti2h7vUJQ6ykyH/MhyT3oq0NUwPnKzQqtyGy+cR3TiU=' 
WHERE 
  key_id = 'f590fc020e00e26cd254ba39eb706f733bea7a12122d9ca423b17bb07f2fac57' 
  AND (
    token = 'ti2h7vUJQ6ykyH/MhyT3oq0NUwPnKzQqtyGy+cR3TiU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029