UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'izjkqpdV6A+WRwQpe7Kdq8cURUh2fm7iYiBeOZA3r+4=' 
WHERE 
  key_id = '844a39296b9a2bb875ade8df5b8d845e5b66ee13565849a47b7cad13136c2939' 
  AND (
    token = 'izjkqpdV6A+WRwQpe7Kdq8cURUh2fm7iYiBeOZA3r+4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050