UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BQS6nbyMo3ikn4LAM+syE7Jk7sVppgYNe+EeHGLmNHU='
WHERE
key_id = '305dd46a3a2489b8f8b3c4c0c39d2b9eda1af47a370bd52938febfca65d5bec4'
AND (
token = 'BQS6nbyMo3ikn4LAM+syE7Jk7sVppgYNe+EeHGLmNHU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)