UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5XZ38dOH3Xg8Mp2GrmCQF4GXzCqijvzX2b2U028sWQQ='
WHERE
key_id = 'b1f8342de82035ced8524965f12cb5c30a3cc7b8e8f84f73e6038e456cef2dfc'
AND (
token = '5XZ38dOH3Xg8Mp2GrmCQF4GXzCqijvzX2b2U028sWQQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)