UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wIHAa70Lgnq2vH87yYXA0lq0OP6x2DcivQyd/RUO6B4='
WHERE
key_id = 'd482b06c7a327cf54bab406ad748c2150ad6c9115f27a1855e9614a28b4dfccb'
AND (
token = 'wIHAa70Lgnq2vH87yYXA0lq0OP6x2DcivQyd/RUO6B4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)