UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Gg3DbHLcHUCHxygWvzV5POmkC4h1vtL+4sZ74sndVA4='
WHERE
key_id = 'b6c7627d8e19a882bb4f6f8c15ede6edb1aea3b2209edc3ef053c8bf5c190be3'
AND (
token = 'Gg3DbHLcHUCHxygWvzV5POmkC4h1vtL+4sZ74sndVA4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)