UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O+/xUysBqbW1hFibx+7Xksmag82PQScWTdAgFZCLMZE='
WHERE
key_id = '4a8b857dbea7e4daf5a97868ec345da7c99a5f58bb198f7573868f4daba6d959'
AND (
token = 'O+/xUysBqbW1hFibx+7Xksmag82PQScWTdAgFZCLMZE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)