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