UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PdiOGGvxel+UZ+/s0WdQu6qA5k7NV5jfH2Lu+E2Sg/8='
WHERE
key_id = '3ff324d8c2c41321b50617660c6ecf7ecc1eac71fda5796e7330d70a232d8e97'
AND (
token = 'PdiOGGvxel+UZ+/s0WdQu6qA5k7NV5jfH2Lu+E2Sg/8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)