UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X8MPB3LOLExverCbwsQXQMDKZSZ2eiOeNN3UN3WljVs='
WHERE
key_id = '387dade6a48dfda921cfca25818e7bdf9478c7201cc45abca7a596b787f2795b'
AND (
token = 'X8MPB3LOLExverCbwsQXQMDKZSZ2eiOeNN3UN3WljVs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)