UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hH26XucPGZjfzKfwWhO0i+aZTCXhzwGLI7zIgzXrcW8='
WHERE
key_id = '1f0a25d72899d2ad6d5176e4b3eea4a36d0bf2a7e36d22c99747ba9d25e8d0df'
AND (
token = 'hH26XucPGZjfzKfwWhO0i+aZTCXhzwGLI7zIgzXrcW8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)