UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pjgAS5yFgwK8qP1zx0ygOMqqfSy2F2F6rRqvjgwKzhU=' 
WHERE 
  key_id = 'b8683d1f40ce42126847d4c2450bc2a32eed760431a70ebab18e1d528fc52349' 
  AND (
    token = 'pjgAS5yFgwK8qP1zx0ygOMqqfSy2F2F6rRqvjgwKzhU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032