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