UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LoMCm1JzZ2nsFwaCbx3vsyMIn9enMa615YyNdEJY2+w='
WHERE
key_id = '7452be5c564e3cfc53d16aa2a2fa313a48817bc061bc70879299fc023fc163ae'
AND (
token = 'LoMCm1JzZ2nsFwaCbx3vsyMIn9enMa615YyNdEJY2+w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)