UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '65VCRj8xh4Xvxwck7fMGlmc0osLGYgox34Qg2ZlGYO4='
WHERE
key_id = '462d71705fd4dfa70f64736de70bd1fa1ab3b2ebab9ac47d6cfe5f7ef71403ad'
AND (
token = '65VCRj8xh4Xvxwck7fMGlmc0osLGYgox34Qg2ZlGYO4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)