UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LGd31+wPUbw+wfyNfXXy6uvzo5IfYSAAB6VJhNHrtYI='
WHERE
key_id = 'd9c2fda4b3a64bc5a541b86c7e4ee1d9a27669a8d301c72165f3249343b834e8'
AND (
token = 'LGd31+wPUbw+wfyNfXXy6uvzo5IfYSAAB6VJhNHrtYI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)