UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dZ7aW9++X3VxoyYHok+9Yb0xr/4E2rMUw6vzx7HfjYQ='
WHERE
key_id = '20ec4bb38669969f2785d4c92a86a7d9accc4638d0899148e53e94df7b67d02d'
AND (
token = 'dZ7aW9++X3VxoyYHok+9Yb0xr/4E2rMUw6vzx7HfjYQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)