UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vhY9KCeDw1M3XwAM9ZXBHEKO485KoEHdmIzFFLlFCVw='
WHERE
key_id = '7c8f6f4231cf44879e995ea7d582c5215a5cb222e0f96ee2828a5f128da1ec39'
AND (
token = 'vhY9KCeDw1M3XwAM9ZXBHEKO485KoEHdmIzFFLlFCVw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)