UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '46Jo0T+P4NBGfOVKrCdR0CKVe4dcD6SEdZyRZ823A50='
WHERE
key_id = 'a447ae23f8b3e49478f8c961f18802906b9386305d048d2667e1fc17d88e2f9f'
AND (
token = '46Jo0T+P4NBGfOVKrCdR0CKVe4dcD6SEdZyRZ823A50='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)