UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NiWj0udwyE4uFqd0Smf/5w3WjDSDR+HqqWkH+AmXVp4='
WHERE
key_id = 'fcec09e008a44d79227093e592b2983f2ae169636f142b2582ce6352dfffbf08'
AND (
token = 'NiWj0udwyE4uFqd0Smf/5w3WjDSDR+HqqWkH+AmXVp4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)