UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PqYOyE0KXl4X5ogzC6nsK11gclUhoUeTal3thB1LjP8='
WHERE
key_id = '394b1818094a4e333e94d0b090eca4a3decd853efb6e0693f25d10dae88c0ec6'
AND (
token = 'PqYOyE0KXl4X5ogzC6nsK11gclUhoUeTal3thB1LjP8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)