UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'e17ivicTKHc890h/KCVZUCAEN8sDcOoHJ+CcgUnlnKM='
WHERE
key_id = 'ee4875c2c7a4e8ec5605ad7af97df2fe244c407c91e8050db70a579d371dc688'
AND (
token = 'e17ivicTKHc890h/KCVZUCAEN8sDcOoHJ+CcgUnlnKM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)