UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NqCVFdH+XVQbAY5FGYoL86Awcz20jm+YnSzwK2ZICaA='
WHERE
key_id = '97853e7d9ef1cc561720df03fda00abd7b816569043ccfb477dcc7bc44d92495'
AND (
token = 'NqCVFdH+XVQbAY5FGYoL86Awcz20jm+YnSzwK2ZICaA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)