UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p6qanstiZiU/6MAOgMUIsJTMlDTMz9//D9pW2cn+G8I='
WHERE
key_id = '1a10f08b9ec3dfe9d11191f57b87f4911bd14c9d9db9d4ee0913eb1e1b0e4574'
AND (
token = 'p6qanstiZiU/6MAOgMUIsJTMlDTMz9//D9pW2cn+G8I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)