UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nQXNZxVs+iRrxTtrS6nXkrw6ZGLrqOoqz8NlMeW90Dg='
WHERE
key_id = 'c7c9f03fc992fd5153437c1e3e2d7e24ef4ee03cf9cf7435ba37642b5dbc56b6'
AND (
token = 'nQXNZxVs+iRrxTtrS6nXkrw6ZGLrqOoqz8NlMeW90Dg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)