UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uSAK8A0EfoyliDwfnZxtCXP49B8KlMlcP9NitWcLAuk='
WHERE
key_id = 'f824f1b828b494fbe4f6ee746571cd179d6b1926f0737e875e7466d0f26a41aa'
AND (
token = 'uSAK8A0EfoyliDwfnZxtCXP49B8KlMlcP9NitWcLAuk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)