UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dGkYAa5I6pNMX11ZOBOXvXKkO/cixqxVTCV7PY1uLtU='
WHERE
key_id = '5d0fc7d8c01f98038fc5f059dee48d6ba22625ee83aedbc5c2177ee41d5e2ce4'
AND (
token = 'dGkYAa5I6pNMX11ZOBOXvXKkO/cixqxVTCV7PY1uLtU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)