UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qlWftYQypvb75sxE0k4lwFykFkJSo8r43zzcf9rtgMs='
WHERE
key_id = '0e5e2ae5265293483c7f50ceab58d9a2fdf38e200e68f371b8db5c78586c0dfa'
AND (
token = 'qlWftYQypvb75sxE0k4lwFykFkJSo8r43zzcf9rtgMs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)