UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gM7tVnf4Jn4CCM7yUr6yPekIjtfNzFo0qg9ElnJ5mTY='
WHERE
key_id = '695c3b46128ef988feb17e072a27c192119e0a7a586c7417d798c29ea92315ec'
AND (
token = 'gM7tVnf4Jn4CCM7yUr6yPekIjtfNzFo0qg9ElnJ5mTY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)