UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P/N+vnQ1/QONIghyBQ4yowSjTm/bxvhzuiWY5+lmCm8='
WHERE
key_id = 'bd0221922474538fa8478f298ec23ce6e781e4e16566ed186af698dec2a234f8'
AND (
token = 'P/N+vnQ1/QONIghyBQ4yowSjTm/bxvhzuiWY5+lmCm8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)