UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yZbD8jWmFWlbJ8m0PSNnrZ8jcPJKKBKLUU6KAuwqUdc='
WHERE
key_id = '89f157224d9c0dd210d3446c19deb12ce4d33df04a57824cb8f7dd1d390a984d'
AND (
token = 'yZbD8jWmFWlbJ8m0PSNnrZ8jcPJKKBKLUU6KAuwqUdc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)